# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=apk-polkit
pkgver=0.6.0
_distsha=1be51962ea3d4509d6c8367f5697c492
pkgrel=0
pkgdesc="A Polkit helper for apk, the Alpine Package Keeper"
url="https://gitlab.alpinelinux.org/Cogitri/apk-polkit"
# SIGSEGV on x86
arch="x86_64 aarch64" # ldc
license="GPL-3.0-or-later"
makedepends="meson polkit-d-dev openssl-d-dev apk-tools-d-dev>=2.10.5.8
	ldc ldc-runtime glibd-dev lld lua5.3-lzlib lua5.3"
checkdepends="bash py3-dbusmock dbus dbus-x11"
subpackages="$pkgname-static $pkgname-dev $pkgname-dbg"
source="https://gitlab.alpinelinux.org/Cogitri/apk-polkit/uploads/$_distsha/apk-polkit-$pkgver.tar.xz"

build() {
	# Needs lld as linker, see: https://github.com/mesonbuild/meson/issues/6987
	DFLAGS="--linker=lld" meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		. output
	ninja -C output
}

check() {
	ninja -C output test
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
}

sha512sums="057c8fba6868ca187f13082ed1b4433cddac81be61d5d28c2cbd3fdf90777a1615e9563d75017a70dd1254b561d2c8c0a146faaef5842c522e6232561d1a6e7f  apk-polkit-0.6.0.tar.xz"
